import { AuthGuard } from './auth.guard';
import { Controller, Post, Body, Put, UseGuards } from '@nestjs/common';
import { RestfulService } from './restful.service';

@Controller('/restful')
@UseGuards(new AuthGuard())
export class RestfulController {
    constructor(private restfulService: RestfulService) {}

    /**
     * 获取数据
     */
    @Post('/')
    async getModel(@Body() body) {
        return this.restfulService.getModel(body);
    }

    /**
     * 更新数据
     */
    @Put('/')
    async createOrUpdateModel(@Body() body) {
        return this.restfulService.createOrUpdateModel(body);
    }

    /**
     * 统计数据
     */
    @Post('/count')
    async condCount(@Body() body) {
        return this.restfulService.condCount(body);
    }
}
